import {defineStore} from 'pinia'
import {ref} from 'vue'

const useTokenStore = defineStore('token',( ) =>{
    const token = ref<string | null>(null)
    const setToken = (newToken:string) =>{token.value = newToken}
    const getToken = () => token.value
    const removeToken = () => {token.value = null}
    return {token,setToken,getToken,removeToken}
},
{
    persist: true, // 开启持久化
  })
export default useTokenStore